Technical Q&A QA1013
Mac OS X and root access


Q: I'm developing on Mac OS X, and some tasks such as running kextload require me to log in as root. But when I try the usual "su root" in Terminal the system rejects my password. How can I get root access on Mac OS X?

A: Mac OS X ships with the root account disabled. This is an intentional security feature to limit the support problems that could arise from casual use of root. However, it is sometimes necessary for developers to switch to the root user, especially when developing kernel extensions.

There are a couple of ways to enable root access. One is to use NetInfo Manager to permanently enable the root account. This approach is best on development systems where there is a frequent need for root access. Detailed instructions are given in the Kernel Extensions tutorial document in /Developer/Documentation/Kernel/Tutorials/KEXTutorials/2Kernel/Test_the_Kernel_Extension.html.

The second approach is best for those situations where you need temporary access to root, such as on a system you wish to keep secure. In this case, use the sudo command in Terminal to either execute a single command as root or to get a root login prompt. Details are in the man page for sudo: type "man sudo" in Terminal to see the documentation.


[Mar 21 2001]


Developer Documentation | Technical Notes | Development Kits | Sample Code